<template>
  <div>
    <el-card class="box-card">
     <el-descriptions title="用户信息">
         <el-descriptions-item label="用户名">{{user_info.username}}</el-descriptions-item>
         <!-- <el-descriptions-item label="手机号">{{user_info.phone}}</el-descriptions-item> -->
         <el-descriptions-item label="包裹总数量">{{user_info.shuliang}} 个</el-descriptions-item>
         <el-descriptions-item label="总充值金额">{{user_info.account}}</el-descriptions-item>
         <el-descriptions-item label="使用总金额">{{user_info.use_money}}</el-descriptions-item>
         <el-descriptions-item label="剩余金额">
          <el-tag size="medium" :type="tagValue">{{user_info.sy_money}}</el-tag>
         </el-descriptions-item>
     </el-descriptions>
    </el-card>
    <el-card class="box-card" style="margin-top: 20px;">
      <el-row :gutter="20">
        <el-col :span="6">
          <div>
            <el-statistic
              group-separator=","
              title="昨天包裹数量"
            >
              <template slot="formatter">
                {{ems_info.zts}}
              </template>
            </el-statistic>
          </div>
        </el-col>
        <el-col :span="6">
          <div>
            <el-statistic title="今天包裹数量">
              <template slot="formatter">
                {{ems_info.jts}}
              </template>
            </el-statistic>
          </div>
        </el-col>
        <el-col :span="6">
          <div>
            <el-statistic title="当月包裹数量">
              <template slot="formatter">
                {{ems_info.dys}}
              </template>
            </el-statistic>
          </div>
        </el-col>
        <el-col :span="6">
          <div>
            <el-statistic title="上个月包裹数量">
              <template slot="formatter">
                {{ems_info.sys}}
              </template>
            </el-statistic>
          </div>
        </el-col>
      </el-row>
    </el-card>

    <el-card class="box-card" style="margin-top: 20px;">
      <el-row :gutter="20">
        <el-col :span="6">
          <div>
            <el-statistic
              group-separator=","
              title="昨天邮费"
            >
              <template slot="formatter">
                {{ems_info.ztfy}}
              </template>
            </el-statistic>
          </div>
        </el-col>
        <el-col :span="6">
          <div>
            <el-statistic title="今天邮费">
              <template slot="formatter">
                {{ems_info.jtfy}}
              </template>
            </el-statistic>
          </div>
        </el-col>
        <el-col :span="6">
          <div>
            <el-statistic title="当月邮费">
              <template slot="formatter">
                {{ems_info.dyfy}}
              </template>
            </el-statistic>
          </div>
        </el-col>
        <el-col :span="6">
          <div>
            <el-statistic title="上个月邮费">
              <template slot="formatter">
                {{ems_info.syfy}}
              </template>
            </el-statistic>
          </div>
        </el-col>
      </el-row>
    </el-card>
  </div>
</template>

<script>
export default {
  data () {
    return {
      like: true,
      value1: 4154.564,
      value2: 1314,
      title: '昨天包裹数量',
      tagValue: '',
      user_info: {

      },
      ems_info: {}
    }
  },
  created () {
    window.sessionStorage.setItem('activePath', '/index')
    this.getUserInfo()
  },
  methods: {
    async getUserInfo () {
      const {
        	data: res
      } = await this.$http.get(
        	'api/admin/article/total'
      )
      console.log(res)
      this.user_info = res.data.user_total
      if (this.user_info.sy_money <= 0) this.tagValue = 'danger'
      this.ems_info = res.data.ems_total
    }
  }
}
</script>
<style lang="less">
  .like {
    cursor: pointer;
    font-size: 25px;
    display: inline-block;
  }
</style>
